package com.hanserwei.mydemo.closure;

public class ClosureDemo03 {
    static void highOrder(ClosureDemo02.Lambda lambda) {
        System.out.println(lambda.op(1));
    }

    public static void main(String[] args) {
        Student s = new Student(10);
        highOrder((int y) -> s.d + y);
        s.d = 20;
        highOrder((int y) -> s.d + y);
    }

    @FunctionalInterface
    interface Lambda {
        int op(int y);
    }

    static class Student {
        int d;

        public Student(int d) {
            this.d = d;
        }
    }
}
